<?php

namespace app\models;

use Yii;

/**
 * This is the model class for table "{{%users}}".
 *
 * @property string $id
 * @property string $username
 * @property integer $isActivated
 * @property integer $isPhone
 * @property string $password
 * @property string $nickname
 * @property string $expire
 * @property string $registerIP
 * @property string $registerTime
 * @property integer $is_admin
 */
class QtkUsers extends \yii\db\ActiveRecord
{
    /**
     * @inheritdoc
     */
    public static function tableName()
    {
        return '{{%users}}';
    }

    /**
     * @return \yii\db\Connection the database connection used by this AR class.
     */
    public static function getDb()
    {
        return Yii::$app->get('qtk');
    }

    /**
     * @inheritdoc
     */
    public function rules()
    {
        return [
            [['username', 'password'], 'required'],
            [['isActivated', 'isPhone', 'registerIP', 'is_admin'], 'integer'],
            [['expire', 'registerTime'], 'safe'],
            [['username', 'nickname'], 'string', 'max' => 50],
            [['password'], 'string', 'max' => 32],
            [['username'], 'unique'],
        ];
    }

    /**
     * @inheritdoc
     */
    public function attributeLabels()
    {
        return [
            'id' => 'ID',
            'username' => '用户名',
            'isActivated' => 'Is Activated',
            'isPhone' => '是否手机号',
            'password' => '密码',
            'nickname' => '昵称',
            'expire' => 'Expire',
            'registerIP' => '注册ip',
            'registerTime' => '注册时间',
            'is_admin' => '是否有后台权限',
        ];
    }
}
